package com.godot.servlet;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.godot.service.Service;
import com.godot.util.Constants;
import com.godot.util.Log;

@SuppressWarnings("serial")
public abstract class MainServlet extends HttpServlet {
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
		this.doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
		resp.setContentType(Constants.kStringContentType);
		
		Log.info("URL : " + req.getRequestURI());
		
		Service init = currentService().init(req, resp);
		init.doStart();
	}
	
	abstract Service currentService();
	
}
